package se.lth.student.axisandroidcam.client;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientOut extends Thread{
	private Socket clientSocket;
	private OutputStream command;
 	private Camera cam;

	public ClientOut(Camera cam) {
		this.cam = cam;
	}
	
	public void setMovieMode() {
		try {
			clientSocket = new Socket("setmovie",AxisAndroidCamera.PORT+cam.getId());
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		try {
			command = clientSocket.getOutputStream();
		} catch (IOException e) {
			e.printStackTrace();
		}
		byte[] newCommand = new byte[1];
		newCommand[0] = 1;
		try {
			command.write(newCommand);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

